package com.example.hxpc.guidancemanagement.activity;

import android.app.Activity;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.KeyEvent;
import android.view.View;
import android.view.WindowManager;
import android.webkit.WebResourceRequest;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.TextView;

import com.example.hxpc.guidancemanagement.R;

/**
 * Created by tao on 2017/12/5.
 */

public class AboutWeActivity extends Activity{
    private WebView webView;
//    private TextView textView;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.activity_about_we);
        initView();
    }

    //设置回退
    //覆盖Activity类的onKeyDown(int keyCoder,KeyEvent event)方法
//    @Override
//    public boolean onKeyDown(int keyCode, KeyEvent event) {
//        if ((keyCode == KeyEvent.KEYCODE_BACK) && webView.canGoBack()) {
//            webView.goBack(); //调用goBack()返回WebView的上一页面
//            return true;
//        }
//        return false;
//    }

    //初始化控件
    public void initView(){
        webView = (WebView) findViewById(R.id.webView);
//        textView = (TextView) findViewById(R.id.te_re_path);
//        textView.setVisibility(View.GONE);
        webView.getSettings().setJavaScriptEnabled(true);
        webView.loadUrl("http://120.78.90.156/#/");
        webView.setWebViewClient(new MyWebViewClient());
    }

    class MyWebViewClient extends WebViewClient{
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            view.loadUrl(url);
            return true;
        }
    }
}
